// 获取当前日期
function getData() {
    const d = new Date()
    const y = d.getFullYear()
    const m = d.getMonth() + 1
    const r = d.getDate()
    const h = d.getHours()
    const mm = d.getMinutes()
    const s = d.getSeconds()
    return `${y}/${m}/${r} ${add0(h)}:${add0(mm)}:${add0(s)}`
}

function preExcel() {
    const d = new Date()
    const y = d.getFullYear()
    const m = d.getMonth() + 1
    const r = d.getDate()
    const h = d.getHours()
    const mm = d.getMinutes()
    const s = d.getSeconds()
    return `${y}${m}${r}${add0(h)}${add0(mm)}${add0(s)}`
}

function getDay() {
    const d = new Date()
    const y = d.getFullYear()
    const m = d.getMonth() + 1
    const r = d.getDate()
    return `${y}/${add0(m)}/${add0(r)}`
}

//修改月、天的格式，保持两位数显示
function add0(m) {
    return m < 10 ? '0' + m : m
}

module.exports = {
    getData,
    getDay,
    preExcel
}